package vcp.gui.panels.networkmanager;

import java.awt.BorderLayout;

import javax.swing.JPanel;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;

import vcp.gui.components.VCPScrollTable;

/**
 * Rates approval pane
 *
 */
public class PnlRatesApproval extends JPanel {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private VCPScrollTable ratesTable;


	/**
	 * Create the panel.
	 */
	public PnlRatesApproval() {
        ratesTable = getRatesTable();
        setLayout(new BorderLayout());
        add(ratesTable,BorderLayout.CENTER);
	}
	
	
	/**
	 * 
	 * @return rates table
	 */
	public VCPScrollTable getRatesTable() {
		if(ratesTable==null){
			String header[] = {"Lot number","Rate type","Rate name", "Current rate","Modified rate","status"};
			DefaultTableModel dtm = new DefaultTableModel(null, header) {
	    		private static final long serialVersionUID = 1L;
	    		@Override
	            public Class<?> getColumnClass(int col) {
	                return getValueAt(0, col).getClass();
	            }
	    	
	            public boolean isCellEditable(int row, int column){  
	                if(column==5)
	                	return true;
	            	return false;  
	            }            
	           
	        };
			
			ratesTable = new VCPScrollTable(10,dtm);			
		    
		    TableColumn column1 = ratesTable.getTable().getColumnModel().getColumn(1);
		    column1.setMinWidth(0);
		    column1.setMaxWidth(0);
		    column1.setWidth(0);
		    column1.setPreferredWidth(0);
		   

		}
		return ratesTable;
	}

}
